package hotel.base.oversea.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * 美团酒店相关枚举
 */
public class MtHotelEnums {

    /**
     *  酒店营业状态：0 营业中1 已关门2 筹建中3 暂停营业
     */
    @Getter
    @AllArgsConstructor
    public enum closeStatusEnum {

        CLOSE_ING(0, "营业中"),
        CLOSED(1, "已关门"),
        CLOSE_NOT(2, "筹建中"),
        CLSOE_STOP(3, "暂停营业");
        private final int code;
        private final String msg;
    }

    /**
     *  酒店星级：0 国家旅游局颁布五星级证书 1 豪华（按五星级标准建造）2 国家旅游局颁布四星级证书 3 高档（按四星级标准建造）
     *  4 国家旅游局颁布三星级证书 5 舒适型（按三星级标准建造）6 经济型 7 低档
     */
    @Getter
    @AllArgsConstructor
    public enum hotelStartEnum {
        START_FIVE_FIRST(0, "国家旅游局颁布五星级证书"),
        START_FIVE_SECOND(1, "豪华（按五星级标准建造）"),
        START_FOUR_FIRST(2, "国家旅游局颁布四星级证书"),
        START_FOUR_SECOND(3, "高档（按四星级标准建造）"),
        START_THREE_FIRST(4, "国家旅游局颁布三星级证书"),
        START_HTREE_SECOND(5, "舒适型（按三星级标准建造）"),
        START_NOMAL(6, "经济型"),
        START_POOR(7, "低档");
        private final int code;
        private final String msg;
    }

    /**
     *  查询策略：
     * 1 基础信息
     * 2 扩展信息
     * 4 房型信息
     * 8 图片信息
     * 策略值可进行加和以查询多项信息 如：
     * 5 查询基础信息和图片信息
     * 15 查询全部信息
     */
    @Getter
    @AllArgsConstructor
    public enum detailStrategyEnum {
        BASE(1, "基础信息"),
        EXT(2, "扩展信息"),
        ROOMTYPE(4, "房型信息"),
        IMAGES(8, "图片信息"),
        BASEPIC(5, "查询基础信息和图片信息"),
        ALL(15, "查询全部信息");
        private final int code;
        private final String msg;
    }

    /**
     * 订单状态：
     * 10 hhb订单创建未提交
     * 20 mt预定中 booking
     * 21 mt预定成功 book_suc
     * 22 mt预定失败 book_fail
     * 30 mt取消中 canceling
     * 31 mt取消成功 cancel_suc
     * 32 取消失败 cancel_fail
     * 40 已消费退款 abort（美团客服介入后才可能出现此状态）
     * 50 已入住 book_checkin
     */
    @Getter
    @AllArgsConstructor
    public enum orderStateEnum {
        CREATE(10, "hhb订单创建未提交"),
        BOOKING(20, "已提交预定中"),
        BOOKINGSUCCSS(21, "预订成功(已确认)(美团异步通知预定成功)"),
        FAILED(22, "预定失败"),
        CANCELING(30, "取消中"),
        CANCELSUCCSS(31, "取消成功"),//上游可能同步返回或者同步返回取消中等待异步通知取消成功或失败
        CANCELFAILED(32,"取消失败"),//上游响应取消失败，不用改订单状态，只要记录订单日志
        REFUND(40, "已消费退款（美团客服介入后才可能出现此状态）"),
        SPLIT_WAIT(42, "人工关注拆单状态"),
        IN(50, "已入住");
        private final int code;
        private final String msg;

        public static String getDesc(Integer code) {
            orderStateEnum[] businessModeEnums = values();
            for (orderStateEnum businessModeEnum : businessModeEnums) {
                if (BigDecimal.valueOf(businessModeEnum.code()).compareTo(new BigDecimal(code))==0) {
                    return businessModeEnum.msg();
                }
            }
            return null;
        }
        public Integer code(){
            return this.code;
        }

        public String msg(){
            return this.msg;
        }

    }

    /**
     * 美团接口api上送参数"method"的所有内容值汇总
     */
    @Getter
    @AllArgsConstructor
    public enum apiMethodEnum {
        METHOD_HOTEL_IDS("hotel.poi.list","美团酒店ids接口"),
        METHOD_HOTEL_DETAIL("hotel.detail","美团订单详情接口"),
        METHOD_HOTEL_ROOM("hotel.realroom.info","美团酒店房型接口"),
        METHOD_HOTEL_GOODS("hotel.goods.rp","美团酒店产品列表接口"),
        METHOD_HOTEL_GOODS_INVENTORY("hotel.goods.inventory","美团酒店产品库存查询接口"),
        METHOD_HOTEL_GOODS_STATUS("hotel.goods.status","美团酒店实时房态查询接口"),
        METHOD_HOTEL_GOODS_PRICE("hotel.oversea.goods.price","美团产品价格日历接口"),
        METHOD_HOTEL_ORDER_CHECK("hotel.order.check","美团下单前校验接口"),
        METHOD_HOTEL_ORDER_BOOKING("hotel.order.booking","美团订单预约下单接口"),
        METHOD_HOTEL_ORDER_CANCEL("hotel.order.cancel","美团订单取消接口"),
        METHOD_HOTEL_ORDER_QUERY("hotel.order.query","美图订单主动查询接口"),
        METHOD_HOTEL_ORDER_REMINDER("hotel.order.reminder","美团订单催单接口"),
        METHOD_HOTEL_ORDER_STATE_CALLBACK("hotel.order.status.change.callback","美团订单状态变更通知"),
        METHOD_HOTEL_ROOM_CALLBACK("hotel.rs.change.callback","美团房态变更通知"),
        METHOD_HOTEL_GOODS_CALLBACK("hotel.rp.change.callback","美团产品规则变更通知"),
        METHOD_HOTEL_INFO_CALLBACK("hotel.poi.change.callback","酒店静态信息变更通知");
        private final String method;
        private final String name;

    }



    /**
     * 酒店上线
     * 1 上线
     * 0 下线
     */
    @Getter
    @AllArgsConstructor
    public enum statusTypeEnum {
        UP(1,"上线"),
        DOWN(0,"下线");
        private final Integer code;
        private final String name;
    }

    /**
     * 产品类型 1 全日房  2  钟点房  3 全日房和钟点房
     */
    @Getter
    @AllArgsConstructor
    public enum goodsTypeEnum {
        oneDay(1,"全日房"),
        timeDay(2,"钟点房"),
        all(2,"全日房和钟点房");
        private final Integer code;
        private final String name;
    }
}
